"use strict";
cc._RF.push(module, 'aa495N+xaxPdqTCGRawvku5', 'RanksUI');
// scripts/RanksUI.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _n20,
    i = void 0 && (void 0).__extends || (_n20 = function n(t, e) {
  return (_n20 = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _n20(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    s = void 0 && (void 0).__decorate || function (t, e, o, n) {
  var i,
      s = arguments.length,
      r = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, o) : n;
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : typeof Reflect) && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, n);else for (var c = t.length - 1; c >= 0; c--) {
    (i = t[c]) && (r = (s < 3 ? i(r) : s > 3 ? i(e, o, r) : i(e, o)) || r);
  }
  return s > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("Common"),
    c = t("BaseUI"),
    a = t("UIEnum"),
    u = t("UIManager"),
    l = t("SDK"),
    d = t("RankItem"),
    p = cc._decorator,
    h = p.ccclass,
    f = p.property,
    g = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.closeBtn = null, e.toggleContainer = null, e.bgNode = null, e.game = null, e.type = 0, e.rankItemPrefab = null, e.rankContent = null, e;
  }

  return i(e, t), e.prototype.onLoad = function () {
    this.closeBtn.on(cc.Node.EventType.TOUCH_END, function (t) {
      this.hide(), t.stopPropagation();
    }, this), this.bgNode.on(cc.Node.EventType.TOUCH_END, function (t) {
      this.hide(), t.stopPropagation();
    }, this);
  }, e.prototype.hide = function () {
    u.UIMgr.hide(a["default"].RankUI, !1, !0);
  }, e.prototype.init = function (t) {
    this.game = t.game, this.type = t.type;
  }, e.prototype.onShow = function () {
    this.node.active = !0, this.node.getChildByName("child").scale = 0, cc.tween(this.node.getChildByName("child")).to(0.2, {
      scale: 1
    }).start(), 0 == this.type ? this.toggleContainer.toggleItems[0].check() : this.toggleContainer.toggleItems[1].check(), this.loadRankFromServer();
  }, e.prototype.loadRankFromServer = function () {
    var t = this,
        e = {};
    e.type = this.type, this.rankContent.destroyAllChildren(), l["default"].sendHttpRequest(r["default"].getRankListUrl, e, function (e) {
      for (var o = e.rs, n = 0; n < o.length; n++) {
        var i = o[n],
            s = cc.instantiate(t.rankItemPrefab);
        s.getComponent(d["default"]).init(t.game, n, i.nickName, i.score), t.rankContent.addChild(s);
      }
    }, function () {});
  }, e.prototype.onEnable = function () {}, e.prototype.onDisable = function () {}, e.prototype.friendButtonFunc = function (t, e) {
    this.type = e, this.loadRankFromServer();
  }, e.prototype.update = function () {}, s([f(cc.Node)], e.prototype, "closeBtn", void 0), s([f(cc.ToggleContainer)], e.prototype, "toggleContainer", void 0), s([f(cc.Node)], e.prototype, "bgNode", void 0), s([f(cc.Prefab)], e.prototype, "rankItemPrefab", void 0), s([f(cc.Node)], e.prototype, "rankContent", void 0), s([h], e);
}(c["default"]);

o["default"] = g;

cc._RF.pop();